<template>
  <view>
    <van-nav-bar
      :title="title || defaultTitle"
      :left-arrow="isbank"
      fixed
      placeholder
      safe-area-inset-top
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
  </view>
</template>
<script>
import { Toast } from "vant";
export default {
  props: {
    isbank: {
      default: true,
    },
    title: {
      default: "",
    },
  },
  data() {
    return {
      defaultTitle: "",
    };
  },
  mounted() {
    this.defaultTitle = document.title;
  },
  methods: {
    onClickLeft() {
      // 返回上一页
      // uni.navigateBack();
      window.history.back()
    },
    onClickRight() {
      Toast("按钮");
    },
  },
  watch: {
    $route(newName, oldName) {
      this.defaultTitle = document.title;
    },
  },
};
</script>
